package com.xymtop.sqlcater;

import com.xymtop.sqlcater.app.commend.CommendApp;
import com.xymtop.sqlcater.core.sql.sqlparser.tosql.entity.sql.SqlApp;
import com.xymtop.sqlcater.core.sql.sqlparser.tosql.entity.xmind.SaveType;
import org.xmind.core.CoreException;

import java.io.IOException;

public class App {
    public static void main(String[] args) throws IOException, CoreException, NoSuchFieldException, ClassNotFoundException, InstantiationException, IllegalAccessException {

        //主要的入口
        if(args.length>0){

            //判断命令类型
            String cmdType = args[0];

            //APP的入口
            if(cmdType.equals("run")){
                //运行命令行
                new CommendApp().run();

            }


            //直接构建
            if(cmdType.equals("build")){

                if(args.length>1) {
                    String path = args[1];

                    if (path != null) {
                        SqlApp sqlApp = new SqlApp();
                        sqlApp.run(path).out(false, new SaveType[]{SaveType.EXECTREE, SaveType.XMIND, SaveType.JSON, SaveType.XMINDTREE, SaveType.JSONTREE});
                    }
                }
            }
        }

    }
}
